package com.ruoyi.project.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.SysGoodMapper;
import com.ruoyi.project.system.domain.SysGood;
import com.ruoyi.project.system.service.ISysGoodService;

/**
 * 商品Service业务层处理
 * 
 * @author theme
 * @date 2021-01-17
 */
@Service
public class SysGoodServiceImpl implements ISysGoodService 
{
    @Autowired
    private SysGoodMapper sysGoodMapper;

    /**
     * 查询商品
     * 
     * @param goodId 商品ID
     * @return 商品
     */
    @Override
    public SysGood selectSysGoodById(Long goodId)
    {
        return sysGoodMapper.selectSysGoodById(goodId);
    }

    /**
     * 查询商品列表
     * 
     * @param sysGood 商品
     * @return 商品
     */
    @Override
    public List<SysGood> selectSysGoodList(SysGood sysGood)
    {
        return sysGoodMapper.selectSysGoodList(sysGood);
    }

    @Override
    public List<SysGood> selectSysGoodLists() {
        return sysGoodMapper.selectSysGoodLists();
    }

    /**
     * 新增商品
     * 
     * @param sysGood 商品
     * @return 结果
     */
    @Override
    public int insertSysGood(SysGood sysGood)
    {
        sysGood.setCreateTime(DateUtils.getNowDate());
        return sysGoodMapper.insertSysGood(sysGood);
    }

    @Override
    public int checkCodeUnique(String code) {
        return sysGoodMapper.checkCodeUnique(code);
    }

    /**
     * 修改商品
     * 
     * @param sysGood 商品
     * @return 结果
     */
    @Override
    public int updateSysGood(SysGood sysGood)
    {
        sysGood.setUpdateTime(DateUtils.getNowDate());
        return sysGoodMapper.updateSysGood(sysGood);
    }

    /**
     * 批量删除商品
     * 
     * @param goodIds 需要删除的商品ID
     * @return 结果
     */
    @Override
    public int deleteSysGoodByIds(Long[] goodIds)
    {
        return sysGoodMapper.deleteSysGoodByIds(goodIds);
    }

    /**
     * 删除商品信息
     * 
     * @param goodId 商品ID
     * @return 结果
     */
    @Override
    public int deleteSysGoodById(Long goodId)
    {
        return sysGoodMapper.deleteSysGoodById(goodId);
    }
}
